import Down
import UIKit

public protocol NodeVisitor {
    func visit(_ document: Document) -> UIView?
    func visit(_ blockQuote: BlockQuote) -> UIView?
    func visit(_ list: List) -> UIView?
    func visit(_ item: Item) -> UIView?
    func visit(_ codeBlock: CodeBlock) -> UIView?
    func visit(_ htmlBlock: HtmlBlock) -> UIView?
    func visit(_ paragraph: Paragraph) -> UIView?
    func visit(_ heading: Heading) -> UIView?
    func visit(_ thematicBreak: ThematicBreak) -> UIView?
    func visit(_ text: Text) -> UIView?
    func visit(_ softBreak: SoftBreak) -> UIView?
    func visit(_ lineBreak: LineBreak) -> UIView?
    func visit(_ code: Code) -> UIView?
    func visit(_ htmlInline: HtmlInline) -> UIView?
    func visit(_ emphasis: Emphasis) -> UIView?
    func visit(_ strong: Strong) -> UIView?
    func visit(_ link: Link) -> UIView?
    func visit(_ image: Image) -> UIView?
}

// 提供默认实现，这样子类只需要实现需要的方法
public extension NodeVisitor {
    func visit(_ document: Document) -> UIView? { nil }
    func visit(_ blockQuote: BlockQuote) -> UIView? { nil }
    func visit(_ list: List) -> UIView? { nil }
    func visit(_ item: Item) -> UIView? { nil }
    func visit(_ codeBlock: CodeBlock) -> UIView? { nil }
    func visit(_ htmlBlock: HtmlBlock) -> UIView? { nil }
    func visit(_ paragraph: Paragraph) -> UIView? { nil }
    func visit(_ heading: Heading) -> UIView? { nil }
    func visit(_ thematicBreak: ThematicBreak) -> UIView? { nil }
    func visit(_ text: Text) -> UIView? { nil }
    func visit(_ softBreak: SoftBreak) -> UIView? { nil }
    func visit(_ lineBreak: LineBreak) -> UIView? { nil }
    func visit(_ code: Code) -> UIView? { nil }
    func visit(_ htmlInline: HtmlInline) -> UIView? { nil }
    func visit(_ emphasis: Emphasis) -> UIView? { nil }
    func visit(_ strong: Strong) -> UIView? { nil }
    func visit(_ link: Link) -> UIView? { nil }
    func visit(_ image: Image) -> UIView? { nil }
} 